package com.yw.controller;

import com.yw.result.R;
import com.yw.service.HeroService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
@Tag(name = "英雄管理",description = "英雄管理")
@RequestMapping("/hero")
public class HeroController {
    @Resource
    private HeroService heroService;

    @Operation(summary = "查询所有英雄",description = "查询所有英雄")
    @PostMapping("/getAllHero")
    public R getAllHero(){
        return R.OK(heroService.list());
    }

    @Operation(summary = "查询所有该城市下的英雄",description = "查询所有该城市下的英雄")
    @PostMapping("/getAllHeroByCityId")
    public R getAllHeroByCityId(Integer cityId){
        return R.OK(heroService.getAllHeroByCityId(cityId));
    }

    @Operation(summary = "查询所有该战争下的英雄",description = "查询所有该战争下的英雄")
    @PostMapping("/getAllHeroByWarId")
    public R getAllHeroByWarId(Integer warId){
        return R.OK(heroService.getAllHeroByWarId(warId));
    }

    @Operation(summary = "查询所有该栏目下的英雄",description = "查询所有该栏目下的英雄")
    @PostMapping("/getAllHeroByColumnId")
    public R getAllHeroByColumnId(Integer columnId){
        return R.OK(heroService.getAllHeroByColumnId(columnId));
    }

    @Operation(summary = "根据事迹查询英雄",description = "根据事迹查询英雄")
    @PostMapping("/getHeroByDeed")
    public R getHeroByDeed(String deed){
        return R.OK(heroService.getHeroByDeed(deed));
    }

    @Operation(summary = "查询所有英雄的城市及名字",description = "查询所有英雄的城市及名字")
    @PostMapping("/listHeroNameAndCity")
    public R listHeroNameAndCity(){
        return R.OK(heroService.listHeroNameAndCity());
    }


}
